package a.f.n;

import a.c.e;
import a.c.n;
import a.c.z;
import a.d.t;
import a.f.*;

import java.util.Iterator;

class w
{
  private static final int a = 0;
  private static final int b = 1;
  private static final int c = 2;
  private static final int d = 3;
  private static final int e = 4;
  private e f;
  private a.f.o g;
  
  w(e parame, a.f.o paramo)
  {
    this.f = parame;
    this.g = paramo;
  }
  
  void a(d.a_ parama_, byte paramByte, double paramDouble, yb paramyb)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    a.c.d locald = this.f.i();
    if (locald == null) {
      return;
    }
    a.c.k localk = this.g.c(oc.a);
    if (!bool2) {
      if (localk == null) {
        return;
      }
    }
    kc[] arrayOfkc = (kc[])localk.get(locald);
    if (!bool2) {
      if (arrayOfkc == null) {
        return;
      }
    }
    if (!bool2) {
      if (arrayOfkc.length == 0) {
        return;
      }
    }
    if (!bool2) {
      if (arrayOfkc.length == 1)
      {
        if (bool2) {
          break label116;
        }
        if (arrayOfkc[0].b() == 0.0D) {
          return;
        }
      }
    }
    if (paramByte < 0)
    {
      label116:
      cd localcd = cd.e(this.g, locald);
      if (!bool2) {
        if (localcd == null) {
          localcd = cd.a((byte)0);
        }
      }
      int i = localcd.b();
      if (!bool2) {
        switch (i)
        {
        case 1: 
        case 3: 
        case 5: 
        case 6: 
        case 7: 
        default: 
          paramByte = 0;
          if (!bool2) {
            if (!bool1) {
              break label246;
            }
          }
        case 4: 
          paramByte = 1;
          if (!bool2) {
            if (!bool1) {
              break label246;
            }
          }
        case 2: 
          paramByte = 2;
          if ((!bool2) && (!bool1)) {
            break label246;
          }
        }
      }
      paramByte = 3;
    }
    label246:
    double d1 = parama_.c();
    double d2 = parama_.d();
    double d3 = d1;
    double d4 = d2;
    zc localzc = this.g.d(this.f);
    tb localtb = a(locald, paramByte);
    z localz = new z();
    int j = 0;
    if (j < arrayOfkc.length) {
      paramyb.a(this.g, arrayOfkc[j], localtb);
    }
    for (;;)
    {
      if (!bool2)
      {
        localz.add(new b_(arrayOfkc[j], j, null));
        j++;
        if (!bool1)
        {
          if (!bool1) {
            break;
          }
          if (bool2) {
            continue;
          }
          localz.k();
        }
      }
    }
    Iterator localIterator = localz.iterator();
    label586:
    label612:
    label893:
    do
    {
      int k;
      a.d.o localo;
      do
      {
        if (!localIterator.hasNext()) {
          break;
        }
        b_ localb_ = (b_)localIterator.next();
        kc localkc = localb_.a;
        if (!bool2) {}
        k = !localIterator.hasNext() ? 1 : 0;
        double d5 = localkc.b();
        double d6 = localkc.c();
        double d7 = Math.max(0.0D, localkc.g().h());
        int m = a(localkc, localtb);
        double d9;
        double d8;
        switch (paramByte)
        {
        default: 
          throw new IllegalStateException("Should not reach");
        case 0: 
          d9 = parama_.h() - d6 - paramDouble;
          if (!bool2) {
            if (m == 3)
            {
              d8 = d1 - d5 - d7;
              if (bool2) {
                break label612;
              }
              if (!bool1) {
                break label586;
              }
            }
          }
          if (m == 2)
          {
            d8 = d1 + d7;
            if (bool2) {
              break label612;
            }
            if (!bool1) {}
          }
          else
          {
            d8 = d1 - d5 * 0.5D;
          }
          d2 = parama_.h() - d6 - paramDouble;
          parama_.a(d1, d2);
          if (bool2) {
            break label937;
          }
          if (!bool1) {
            break;
          }
        case 1: 
          d8 = parama_.i() + paramDouble;
          if (!bool2) {
            if (m == 0)
            {
              d9 = d2 - d6 - d7;
              if (bool2) {
                break label713;
              }
              if (!bool1) {
                break label687;
              }
            }
          }
          if (m == 1)
          {
            d9 = d2 + d7;
            if (bool2) {
              break label713;
            }
            if (!bool1) {}
          }
          else
          {
            d9 = d2 - d6 * 0.5D;
          }
          d1 = parama_.i() + d5 + paramDouble;
          parama_.a(d1, d2);
          if (bool2) {
            break label937;
          }
          if (!bool1) {
            break;
          }
        case 2: 
          d9 = parama_.j() + paramDouble;
          if (!bool2) {
            if (m == 2)
            {
              d8 = d1 + d7;
              if (bool2) {
                break label815;
              }
              if (!bool1) {
                break label789;
              }
            }
          }
          if (m == 3)
          {
            d8 = d1 - d5 - d7;
            if (bool2) {
              break label815;
            }
            if (!bool1) {}
          }
          else
          {
            d8 = d1 - d5 * 0.5D;
          }
          d2 = parama_.j() + d6 + paramDouble;
          parama_.a(d1, d2);
          if (bool2) {
            break label937;
          }
          if (!bool1) {
            break;
          }
        case 3: 
          d8 = parama_.g() - d5 - paramDouble;
          if (!bool2) {
            if (m == 1)
            {
              d9 = d2 + d7;
              if (bool2) {
                break label904;
              }
              if (!bool1) {
                break label893;
              }
            }
          }
          if (m == 0)
          {
            d9 = d2 - d6 - d7;
            if (bool2) {
              break label904;
            }
            if (!bool1) {}
          }
          else
          {
            d9 = d2 - d6 * 0.5D;
          }
          d1 = parama_.g() - d5 - paramDouble;
          parama_.a(d1, d2);
        }
        localkc.b(d8 - localzc.a(), d9 - localzc.b());
        localo = new a.d.o(localkc.a());
        localo.f(localzc.a(), localzc.b());
        parama_.a(localo);
      } while (k == 0);
      double d10 = 0.0D;
      double d11 = 0.0D;
      if ((bool2) || ((!bool2) && (bool1))) {
        return;
      }
      if (!bool2)
      {
        switch (paramByte)
        {
        case 0: 
          d11 = -paramDouble;
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break;
          }
        case 1: 
          d10 = paramDouble;
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break;
          }
        case 2: 
          d11 = paramDouble;
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break;
          }
        case 3: 
          d10 = -paramDouble;
        }
        localo.f(d10, d11);
        if (bool2) {
          break label1124;
        }
        parama_.a(localo);
        d1 += d10;
        d2 += d11;
      }
    } while (!bool1);
    label687:
    label713:
    label1124:
    parama_.a(d3, d4, d1, d2);
    label789:
    label815:
    return;
  }
  
  private tb a(a.c.d paramd, byte paramByte)
  {
    n localn = (n)this.g.c(d.z);
    int i = localn.get(paramd) != null ? 1 : 0;
    if (!k.n) {}
    switch (paramByte)
    {
    case 0: 
      return i != 0 ? tb.a : tb.c;
    case 1: 
      return i != 0 ? tb.b : tb.d;
    case 2: 
      return i != 0 ? tb.c : tb.a;
    case 3: 
      return i != 0 ? tb.d : tb.b;
    }
    throw new IllegalStateException("Unknown node placer direction " + paramByte);
  }
  
  private int a(kc paramkc, tb paramtb)
  {
    boolean bool = k.n;
    fd localfd = paramkc.g();
    if (!bool) {
      if (!localfd.o())
      {
        int i = (bool) || ((paramtb == tb.d) || (paramtb == tb.b)) ? 1 : 0;
        int j = (bool) || ((paramtb == tb.a) || (paramtb == tb.c)) ? 1 : 0;
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.a))
          {
            if (bool) {
              break label205;
            }
            if (localfd.n()) {
              break label204;
            }
          }
        }
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.c))
          {
            if (bool) {
              break label205;
            }
            if (localfd.p()) {
              break label204;
            }
          }
        }
        if (!bool) {
          if (localfd.x())
          {
            if (bool) {
              break label174;
            }
            if (j != 0)
            {
              if (bool) {
                break label205;
              }
              if (localfd.n()) {
                break label204;
              }
            }
          }
        }
        label174:
        if (!bool) {
          if (localfd.y())
          {
            if (bool) {
              break label210;
            }
            if (j != 0)
            {
              if (bool) {
                break label210;
              }
              if (localfd.n()) {
                label204:
                label205:
                return 3;
              }
            }
          }
        }
        label210:
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.a))
          {
            if (bool) {
              break label337;
            }
            if (localfd.p()) {
              break label336;
            }
          }
        }
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.c))
          {
            if (bool) {
              break label337;
            }
            if (localfd.n()) {
              break label336;
            }
          }
        }
        if (!bool) {
          if (localfd.x())
          {
            if (bool) {
              break label306;
            }
            if (j != 0)
            {
              if (bool) {
                break label337;
              }
              if (localfd.p()) {
                break label336;
              }
            }
          }
        }
        label306:
        if (!bool) {
          if (localfd.y())
          {
            if (bool) {
              break label342;
            }
            if (j != 0)
            {
              if (bool) {
                break label342;
              }
              if (localfd.p()) {
                label336:
                label337:
                return 2;
              }
            }
          }
        }
        label342:
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.d))
          {
            if (bool) {
              break label469;
            }
            if (localfd.p()) {
              break label468;
            }
          }
        }
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.b))
          {
            if (bool) {
              break label469;
            }
            if (localfd.n()) {
              break label468;
            }
          }
        }
        if (!bool) {
          if (localfd.x())
          {
            if (bool) {
              break label438;
            }
            if (i != 0)
            {
              if (bool) {
                break label469;
              }
              if (localfd.n()) {
                break label468;
              }
            }
          }
        }
        label438:
        if (!bool) {
          if (localfd.y())
          {
            if (bool) {
              break label474;
            }
            if (i != 0)
            {
              if (bool) {
                break label474;
              }
              if (localfd.p()) {
                label468:
                label469:
                return 0;
              }
            }
          }
        }
        label474:
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.d))
          {
            if (bool) {
              break label601;
            }
            if (localfd.n()) {
              break label600;
            }
          }
        }
        if (!bool) {
          if ((localfd.w()) && (paramtb == tb.b))
          {
            if (bool) {
              break label601;
            }
            if (localfd.p()) {
              break label600;
            }
          }
        }
        if (!bool) {
          if (localfd.x())
          {
            if (bool) {
              break label570;
            }
            if (i != 0)
            {
              if (bool) {
                break label601;
              }
              if (localfd.p()) {
                break label600;
              }
            }
          }
        }
        label570:
        if (bool) {
          break label603;
        }
        if (localfd.y())
        {
          if (bool) {
            break label603;
          }
          if (i != 0)
          {
            if (bool) {
              break label603;
            }
            if (localfd.n()) {
              label600:
              label601:
              return 1;
            }
          }
        }
      }
    }
    label603:
    return 4;
  }
  
  void a(d.a_ parama_)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    zc localzc = this.g.d(this.f);
    a.c.k localk = this.g.c(oc.b);
    if ((bool2) || (localk != null))
    {
      kc[] arrayOfkc = (kc[])localk.get(this.f);
      if (arrayOfkc != null)
      {
        double d1 = localzc.a() + localzc.c() / 2.0D;
        double d2 = localzc.b() + localzc.d() / 2.0D;
        int i = 0;
        do
        {
          if (i >= arrayOfkc.length) {
            break;
          }
          kc localkc = arrayOfkc[i];
          t localt = localkc.a().a();
          parama_.b(localt.d + d1, localt.e + d2, localt.a, localt.b);
          i++;
        } while (!bool1);
      }
    }
  }
  
  private static final class b_
    implements Comparable
  {
    kc a;
    int c;
    
    private b_(kc paramkc, int paramInt)
    {
      this.a = paramkc;
      this.c = paramInt;
    }
    
    public int compareTo(Object paramObject)
    {
      boolean bool = k.n;
      b_ localb_ = (b_)paramObject;
      fd localfd1 = this.a.g();
      fd localfd2 = localb_.a.g();
      if (!bool) {}
      if (!bool) {}
      int i = localfd1.k() ? 0 : localfd1.l() ? -1 : 1;
      if (!bool) {}
      if (!bool) {}
      int j = localfd2.k() ? 0 : localfd2.l() ? -1 : 1;
      return i - j;
    }
    
    b_(kc paramkc, int paramInt, w.0 param0)
    {
      this(paramkc, paramInt);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.n.w

 * JD-Core Version:    0.7.0.1

 */